package com.jt.www.job.zq;

import com.jt.www.common.service.ContractService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.ParseException;
import java.util.Date;

@Component
@EnableScheduling
public class ScheduleRunner {
    public static final Logger log = LoggerFactory.getLogger(ScheduleRunner.class);
    @Autowired
    private ContractService contractService;

    /**
     * 协议大于365天进行无效更新-每天凌晨执行
     *
     * @throws ParseException
     */
    @Scheduled(cron = "0 10 0 * * ?")
    public void updateAgreementStatus() throws ParseException {
        contractService.updateAgreementStatus();
        log.info("========================定时程序：协议失效" + new Date(System.currentTimeMillis()));
    }
}
